home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
ac2vb3
/
frmdemom.frm
< prev
next >
Wrap
Text File
|
1994-03-01
|
20KB
|
676 lines
VERSION 2.00
Begin Form frmDemoMain
BackColor = &H00C0C0C0&
Caption = "JET 2.0 VB3 Demo"
ClientHeight = 6390
ClientLeft = 1485
ClientTop = 1635
ClientWidth = 8970
Height = 7110
Icon = FRMDEMOM.FRX:0000
Left = 1410
LinkTopic = "Form1"
ScaleHeight = 6390
ScaleWidth = 8970
Top = 990
Width = 9120
Begin CommandButton cmdExit
Caption = "E&xit"
Height = 375
Left = 1980
TabIndex = 11
Top = 3420
Width = 1035
End
Begin CommandButton cmdGo
Caption = "&Go"
Height = 375
Left = 720
TabIndex = 10
Top = 3420
Width = 1095
End
Begin TextBox txtDBLocation
Height = 315
Left = 3780
TabIndex = 12
Text = "C:\VB\BIBLIO.MDB"
Top = 3480
Width = 5055
End
Begin SSFrame Frame3D1
Caption = "&Demo"
Height = 3255
Left = 120
TabIndex = 14
Top = 120
Width = 3495
Begin SSOption o3dDemo
Caption = "Other New Features"
Height = 195
Index = 20
Left = 180
TabIndex = 9
Top = 2820
Width = 2715
End
Begin SSOption o3dDemo
Caption = "Correlated Subqueries"
Height = 195
Index = 3
Left = 180
TabIndex = 3
Top = 1080
Width = 2715
End
Begin SSOption o3dDemo
Caption = "Top n Query"
Height = 195
Index = 2
Left = 180
TabIndex = 2
Top = 840
Width = 2715
End
Begin SSOption o3dDemo
Caption = "DDL Create Index"
Height = 195
Index = 12
Left = 180
TabIndex = 6
Top = 1980
Width = 2895
End
Begin SSOption o3dDemo
Caption = "Insert using Values clause"
Height = 195
Index = 14
Left = 180
TabIndex = 8
Top = 2460
Width = 2715
End
Begin SSOption o3dDemo
Caption = "DDL Drop Table"
Height = 195
Index = 13
Left = 180
TabIndex = 7
Top = 2220
Width = 2715
End
Begin SSOption o3dDemo
Caption = "DDL Alter Table - add column"
Height = 195
Index = 11
Left = 180
TabIndex = 5
Top = 1740
Width = 2895
End
Begin SSOption o3dDemo
Caption = "DDL Create Table"
Height = 195
Index = 10
Left = 180
TabIndex = 4
Top = 1500
Width = 2715
End
Begin SSOption o3dDemo
Caption = "Sub-Select Query"
Height = 195
Index = 1
Left = 180
TabIndex = 1
Top = 600
Width = 2715
End
Begin SSOption o3dDemo
Caption = "UNION Query"
Height = 195
Index = 0
Left = 180
TabIndex = 0
Top = 360
Width = 2715
End
End
Begin Grid grdDemo
Cols = 10
FixedCols = 0
Height = 2415
Left = 120
Rows = 10
TabIndex = 13
Top = 3840
Width = 8715
End
Begin Label Label2
BackStyle = 0 'Transparent
Caption = "SQL Command"
Height = 255
Left = 3900
TabIndex = 17
Top = 120
Width = 1935
End
Begin Label lblExampleText
BorderStyle = 1 'Fixed Single
FontBold = 0 'False
FontItalic = 0 'False
FontName = "MS Sans Serif"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 2775
Left = 3780
TabIndex = 16
Top = 300
Width = 4935
End
Begin Label Label1
BackStyle = 0 'Transparent
Caption = "Sample DB Location"
Height = 255
Left = 3780
TabIndex = 15
Top = 3240
Width = 2175
End
Begin Shape Shape1
BackColor = &H00808080&
BackStyle = 1 'Opaque
BorderStyle = 0 'Transparent
Height = 2775
Left = 3840
Top = 360
Width = 4935
End
Begin Menu mnuFile
Caption = "F&ile"
Begin Menu mnuFileCommands
Caption = "&About"
Index = 0
End
Begin Menu mnuFileCommands
Caption = "E&xit"
Index = 1
End
End
End
Option Explicit
Dim gDefaultDatabase As database
Dim DBOpen_OK As Integer
Sub ClearGrid ()
Dim i As Integer
Dim j As Integer
For i = 0 To 9
For j = 0 To 9
grdDemo.Col = i
grdDemo.Row = j
grdDemo.Text = ""
Next j
Next i
End Sub
Sub cmdExit_Click ()
Unload Me
End Sub
Sub cmdGo_Click ()
On Error Resume Next
Dim ds As dynaset
Dim i As Integer
If Not DBOpen_OK Then
Set gDefaultDatabase = OpenDatabase(txtDBLocation.Text)
If Err <> 0 Then
MsgBox "Error Opening: " & txtDBLocation.Text
Exit Sub
End If
DBOpen_OK = True
End If
ClearGrid
ResetGridWidths
'UNION Query
If o3dDemo(0).Value = -1 Then
Me.MousePointer = 11
grdDemo.ColWidth(1) = 2000
grdDemo.ColWidth(2) = 1500
grdDemo.Row = 0
grdDemo.Col = 0
grdDemo.Text = "ID"
grdDemo.Col = 1
grdDemo.Text = "Name"
grdDemo.Col = 2
grdDemo.Text = "Type"
Set ds = gDefaultDatabase.CreateDynaset(lblExampleText)
If ds.RecordCount <> 0 Then
i = 1
Do Until ds.EOF
grdDemo.Row = (i)
grdDemo.Col = 0
grdDemo.Text = ds(0)
grdDemo.Col = 1
grdDemo.Text = ds(1)
grdDemo.Col = 2
grdDemo.Text = ds(2)
ds.MoveNext
i = i + 1
If i > 9 Then
Exit Do
End If
Loop
End If
Me.MousePointer = 0
End If
'Sub-Select Query
If o3dDemo(1).Value = -1 Then
Me.MousePointer = 11
grdDemo.ColWidth(1) = 2000
grdDemo.ColWidth(2) = 2500
g